import 'package:flutter/material.dart';
import 'package:tu_home/my/my.dart';
import 'package:tu_home/order/order-list.dart';
import 'package:tu_home/project/project.dart';

import 'index/index.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.white),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: '兔管家'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  int _selectIndex = 0;

  List<Widget> widgets = [Index(),Project(),My()];


  @override
  Widget build(BuildContext context) {
    return  Scaffold(
      backgroundColor: Color.fromRGBO(200, 200, 200, 0.2),
      body: Center(
        child: widgets[_selectIndex],
      ),
      bottomNavigationBar: BottomNavigationBar(
        onTap: (index)=> {
          setState(() => {
            _selectIndex = index
          })
        },
        type: BottomNavigationBarType.fixed,
        items: [
          BottomNavigationBarItem(icon: Icon(Icons.home),label: '首页'),
          BottomNavigationBarItem(icon: Icon(Icons.today), label: '项目'),
          BottomNavigationBarItem(icon: Icon(Icons.person), label:  '我的'),
        ],
      ),
    );
  }
}
